﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using SEO.Business;

public partial class MedicalList : AdminPage
{
    protected int nNum = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            InitData();
        }
    }

    protected void InitData()
    {
        DataTable dt = new BisMedical().GetList();
        if (dt!=null&&dt.Rows.Count>0)
        {
            noData.Style["display"] = "none";
        }
        else
        {
            noData.Style["display"] = "block";
        }
        rptMedical.DataSource = dt;
        rptMedical.DataBind();
        dt.Dispose();
    }

    /// <summary>
    /// 权限控制
    /// </summary>
    /// <returns></returns>
    public override long GetNeededFeatures()
    {
        return AdminFEATURE.MedicalList;
    }

    /// <summary>
    /// 列表绑定
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void rptMedical_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            //删除信息
            bool result = new BisMedical().Delete(Convert.ToInt32(e.CommandArgument));
            Until.Alert(result ? "删除成功！" : "删除失败！");
            InitData();
        }
    }

    /// <summary>
    /// 刷新页面
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnReset_Click(object sender, EventArgs e)
    {
        InitData();
    }
}